package com.k2data.k2app.domain.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.k2data.k2app.constant.Constant;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;

/**
 * @author lidong9144@163.com 17-3-20.
 */
@Data
@Table(name = "event_device")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class EventDevice implements Serializable {

    @Transient
    private static final long serialVersionUID = 6134805051724715035L;

    @JsonIgnore
    @Id
    @GeneratedValue(generator = "JDBC")
    private Long id;
    private Long deviceId;
    private Long componentId;
    private String eventNo;
    private String eventName;
    private String eventType;
    @JsonFormat(pattern = Constant.ISO_FORMAT)
    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
    private LocalDateTime startTime;
    @JsonFormat(pattern = Constant.ISO_FORMAT)
    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
    private LocalDateTime endTime;
    private String owner;
    private String dealMethod;
    private String status;
    private String detail;
    private String createBy;
    private String updateBy;
    @JsonIgnore
    private ZonedDateTime createTime;
    @JsonIgnore
    private ZonedDateTime updateTime;

    // 关联表
    @JsonIgnore
    @Transient
    private Device device;

    @Transient
    @JsonIgnore
    private Integer count;
    @Transient
    @JsonIgnore
    private String type;

    // cond
    @JsonIgnore
    @Transient
    private LocalDate startTimeGreater;
    @JsonIgnore
    @Transient
    private LocalDate startTimeLess;
    @JsonIgnore
    @Transient
    private String orderBy;

}
